home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 April
/
PCWorld_2008-04_cd.bin
/
komercni software
/
miton
/
SystemMechanic7Pro.exe
/
{app}
/
smhtml.dll
/
1033
/
HTML
/
ACTIONBUTTON.JS
< prev
next >
Wrap
Text File
|
2008-01-24
|
7KB
|
173 lines
var __ACTION_BUTTON_LINK = "<a onfocus=this.blur(); id=\"{ID}\" href=\"javascript:{EVENT}\" class=\"{CLASS}\" style=\"{STYLE}\">{TEXT}</a>";
var __ACTION_BUTTON_SUBMIT = "<input id=\"{ID}\" type=\"submit\" onclick=\"{EVENT}\" value=\"{TEXT}\" class=\"{CLASS}\" style=\"{STYLE}\">";
var __ACTION_BUTTON_CHECKBOX = "<div class=\"{CLASS}\" style=\"{STYLE}\"><input id=\"{ID}\" type=\"checkbox\" onclick=\"{EVENT}\"><label for=\"{ID}\">{TEXT}</label></div>";
var __ACTION_BUTTON_IMAGE = "<img id=\"{ID}\" src=\"{IMAGE}\" align=\"absmiddle\" onclick=\"{EVENT}\" class=\"{CLASS}\" style=\"{STYLE}\" onmouseover=\"this.src='{IMAGEHOVER}';\" onmouseout=\"this.src='{IMAGE}';\">";
var __ACTION_BUTTON_CUSTOM = "<a class=\"{CLASS} {FLOAT}\" style=\"{WIDTH} \" ";
__ACTION_BUTTON_CUSTOM += " onmouseover=\"this.className='button_hover {FLOAT}';\" ";
__ACTION_BUTTON_CUSTOM += " onmouseout=\"this.className='{CLASS} {FLOAT}';\" ";
__ACTION_BUTTON_CUSTOM += " onmouseup=\"this.className='button_hover {FLOAT}';\" ";
__ACTION_BUTTON_CUSTOM += " onmousedown=\"this.className='button_active {FLOAT}';\" href=\"javascript:void(0);\" onfocus=\"this.blur();\" ";
__ACTION_BUTTON_CUSTOM += " onclick=\"{EVENT}\"><span class=\"bt_left\"><span class=\"label\">{TEXT}</span></span></a>";
var __ACTION_BUTTON_CUSTOM_DROPDOWN = "<div class=\"button_dropdown {FLOAT}\"> <a class=\"button_dropdown_left\" style=\"{WIDTH}\" ID=\"{ID}\" href=\"javascript:void(0);\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseover=\"this.className='button_dropdown_left_hover';Get('{ID}_2').className='button_dropdown_right_hover';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseout=\"this.className='button_dropdown_left';Get('{ID}_2').className='button_dropdown_right';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmousedown=\"this.className='button_dropdown_left_active';Get('{ID}_2').className='button_dropdown_right_active';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseup=\"this.className='button_dropdown_left_hover';Get('{ID}_2').className='button_dropdown_right_hover';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += " onfocus=\"this.blur();\" onclick=\"{EVENT}\" ><span class=\"bt_left\"><span class=\"label\">{TEXT}</span></span></a> ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "<a class=\"button_dropdown_right {FLOAT}\" id=\"{ID}_2\" style=\"float:left;\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseover=\"this.className='button_dropdown_right_hover_highlighted';Get('{ID}').className='button_dropdown_left_hover';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseout=\"this.className='button_dropdown_right';Get('{ID}').className='button_dropdown_left';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmousedown=\"this.className='button_dropdown_right_active';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "onmouseup=\"this.className='button_dropdown_right_hover_highlighted';Get('{ID}').className='button_dropdown_left_hover';\" ";
__ACTION_BUTTON_CUSTOM_DROPDOWN += "href=\"javascript:void(0);\" onfocus=\"this.blur();\" onclick=\"{EVENT2}\" ></a> </div>";
var ACTION_BUTTON_LINK = "1";
var ACTION_BUTTON_SUBMIT = "2";
var ACTION_BUTTON_CHECKBOX = "3";
var ACTION_BUTTON_IMAGE = "4";
var ACTION_BUTTON_CUSTOM = "5";
var ACTION_BUTTON_CUSTOM_DROPDOWN = "6";
function ActionButton()
{
this.ID;
this.Text = "";
this.Type = ACTION_BUTTON_LINK;
this.Event = "";
this.Event2 = "";
this.Class = "";
this.Style = "";
this.Image = "";
this.ImageHover = "";
this.MouseOverEvent = "";
this.MouseOutEvent = "";
this.Width = "73";
this.FloatClass = "floatL"; //floatR , floatL
this.Render = __RenderActionButton;
this.Enable = __EnableActionButton;
this.Disable = __DisableActionButton;
this.HoverOn = __HoverOnActionButton;
this.HoverOff = __HoverOffActionButton;
this.SetText = __SetText;
this.SetImage = __ActionButtonSetImage;
this._Enabled = true;
this._Rendered = false;
}
function __RenderActionButton()
{
var content = "";
if (this.Type == ACTION_BUTTON_LINK)
{
content = __ACTION_BUTTON_LINK;
}
else if (this.Type == ACTION_BUTTON_SUBMIT)
{
content = __ACTION_BUTTON_SUBMIT;
}
else if (this.Type == ACTION_BUTTON_CHECKBOX)
{
content = __ACTION_BUTTON_CHECKBOX;
}
else if (this.Type == ACTION_BUTTON_IMAGE)
{
content = __ACTION_BUTTON_IMAGE;
}
else if (this.Type == ACTION_BUTTON_CUSTOM)
{
content = __ACTION_BUTTON_CUSTOM;
if( this.Width != "")
content = content.replace( "{WIDTH}", "width:" + this.Width + "px;");
else
content = content.replace( "{WIDTH}", "");
if(this.Class == "")
this.Class = "button";
}
else if (this.Type == ACTION_BUTTON_CUSTOM_DROPDOWN)
{
content = __ACTION_BUTTON_CUSTOM_DROPDOWN;
if( this.Width != "")
content = content.replace( "{WIDTH}", "width:" + (this.Width -15) + "px;");
else
content = content.replace( "{WIDTH}", "");
}
if( this.Float != "")
content = content.replace( /{FLOAT}/g, this.FloatClass );
if( this.MouseOverEvent != "")
content = content.replace( "this.src='{IMAGEHOVER}'", this.MouseOverEvent );
if( this.MouseOutEvent != "")
content = content.replace( "this.src='{IMAGE}'", this.MouseOutEvent );
if( this.ImageHover != "" )
content = content.replace("{IMAGEHOVER}", this.ImageHover);
else
{
content = content.replace( "onmouseover=\"this.src='{IMAGEHOVER}';\"", "");
content = content.replace( "onmouseout=\"this.src='{IMAGE}';\"", "");
}
content = content.replace(/{ID}/g, this.ID);
content = content.replace("{TEXT}", this.Text);
content = content.replace("{EVENT}", this.Event);
content = content.replace("{EVENT2}", this.Event2);
content = content.replace(/{CLASS}/g, this.Class);
content = content.replace("{STYLE}", this.Style);
content = content.replace("{IMAGE}", this.Image);
content = content.replace("{IMAGE}", this.Image);
content = content.replace("{IMAGEHOVER}", this.ImageHover);
this._Rendered = true;
return content;
}
function __EnableActionButton()
{
var element = Get(this.ID);
element.disabled = false;
this._Enabled = true;
}
function __DisableActionButton()
{
var element = Get(this.ID);
element.disabled = true;
this._Enabled = false;
}
function __HoverOnActionButton()
{
var img = Get(this.ID);
img.src = this.ImageHover;
}
function __HoverOffActionButton()
{
var img = Get(this.ID);
img.src = this.Image;
}
function __SetText( text )
{
Get( this.ID ).innerHTML = text;
}
function __ActionButtonSetImage( value )
{
var img = Get( this.ID);
img.src = value;
}